<?php
//$this->PostBackParams->Set('LabelTypePairCount', (count($this->Calendar->CustomFieldsArr) > 0? count($this->Calendar->CustomFieldsArr):1), 1, 'LabelTypePairCount');
echo '<div id="Form" class="Account CalendarForm">
	<fieldset>
		<legend>'.$this->Context->GetDefinition('VcalCalendarManagement').'</legend>'
		.$this->Get_Warnings()
		.$this->Get_PostBackForm('frmCalendar');

		if ($CalendarID > 0) {
			$this->CalendarSelect->Attributes = "onchange=\"document.location='".GetUrl($this->Context->Configuration, $this->Context->SelfUrl, '', '', '', '', 'PostBackAction=Calendar')."&amp;CalendarID='+this.options[this.selectedIndex].value;\" id=\"sCalendarSelect\"";
			$this->CalendarSelect->SelectedValue = $CalendarID;
			echo '<h2>'.$this->Context->GetDefinition('VcalGetCalendarToEdit').'</h2>
				<ul>
					<li>
						<label for="sCalendarSelect">'.$this->Context->GetDefinition('VcalCalendars').' <small>'.$this->Context->GetDefinition('Required').'</small></label>
						'.$this->CalendarSelect->Get().'
					</li>
				</ul>
				<h2>'.$this->Context->GetDefinition('VcalModifyCalendarDefinition').'</h2>
				<input type="hidden" name="CalendarID" value="'.$this->Calendar->CalendarID.'" maxlength="80" />';
		} else {
			echo '<h2>'.$this->Context->GetDefinition('VcalDefineNewCalendar').'</h2>';
		}
		echo '<ul>
			<li>
				<label for="txtCalendarName">'.$this->Context->GetDefinition('VcalCalendarTitle').' <small>'.$this->Context->GetDefinition('Required').'</small></label>
				<input type="text" name="Title" value="'.$this->Calendar->Title.'" maxlength="80" class="SmallInput" id="txtCalendarName" />
				<p class="Description">'.$this->Context->GetDefinition('VcalCalendarTitleNotes').'</p>
			</li>
			<li>
				<p><span>'.GetDynamicCheckbox('RequireApproval', 1, $this->Calendar->RequireApproval, '', $this->Context->GetDefinition('VcalCalendarRequireApproval')).'</span></p>
			</li>
			<li>
				<label for="txtCalendarDescription">'.$this->Context->GetDefinition('VcalCalendarDescription').' <small>'.$this->Context->GetDefinition('Optional').'</small></label>
				<textarea name="Description" id="txtCalendarDescription" class="LargeTextbox">'.$this->Calendar->Description.'</textarea>
				<p class="Description">'.$this->Context->GetDefinition('VcalCalendarDescriptionNotes').'</p>
			</li>';
			$this->CallDelegate('PreColorRender');
			echo '<li>
				<fieldset id="color_scheme_form">
					<p class="Description"><strong>'.$this->Context->GetDefinition('VcalCalendarColor').'</strong><br />
					'.$this->Context->GetDefinition('VcalCalendarColorNotes').'</p>
			
					<div class="color-form">
						<div id="edit-scheme-wrapper" class="form-item">
							<label for="edit-scheme">'.$this->Context->GetDefinition('VcalCalendarColorPredefined').'</label>
							'.$this->ColorSelect->Get().'
						</div>
						<div class="clear-block" id="palette">
							<div id="edit-palette-bottom-wrapper" class="form-item">
								<label for="edit-palette-background">'.$this->Context->GetDefinition('VcalCalendarColorBackground').'</label>
								<input type="text" class="form-text" value="'.$this->Calendar->ColorArr[0].'" id="edit-palette-background" name="ColorArr[]" maxlength="7" />
							</div>
							<div id="edit-palette-top-wrapper" class="form-item">
								<label for="edit-palette-border">'.$this->Context->GetDefinition('VcalCalendarColorBorder').'</label>
								<input type="text" class="form-text" value="'.$this->Calendar->ColorArr[1].'" id="edit-palette-border" name="ColorArr[]" maxlength="7" />
							</div>
							<div id="edit-palette-text-wrapper" class="form-item">
								<label for="edit-palette-text">'.$this->Context->GetDefinition('VcalCalendarColorText').'</label>
								<input type="text" class="form-text" value="'.$this->Calendar->ColorArr[2].'" id="edit-palette-text" name="ColorArr[]" maxlength="7" />
							</div>
							<div id="edit-palette-text-wrapper" class="form-item">
								<label for="edit-palette-time">'.$this->Context->GetDefinition('VcalCalendarColorTime').'</label>
								<input type="text" class="form-text" value="'.$this->Calendar->ColorArr[3].'" id="edit-palette-time" name="ColorArr[]" maxlength="7" />
							</div>
						</div>
						<div id="preview">
							<p class="Description"><strong>'.$this->Context->GetDefinition('VcalCalendarColorPreview').'</strong><br />
							'.$this->Context->GetDefinition('VcalCalendarColorPreviewNotes').'</p>
						</div>
					</div>
				
				</fieldset>
			</li>';
			$this->CallDelegate('PreRolesRender');
			echo '<li>
				<p class="Description">
					<strong>'.$this->Context->GetDefinition('Roles').'</strong>
					<br />'.$this->Context->GetDefinition('VcalRolesInCalendar').'
				</p>
			</li>
			<li>
				<p class="Description">
				'.$this->Context->GetDefinition('Check')
				." <a href=\"./\" onclick=\"CheckAll('CalendarRoleBlock'); return false;\">".$this->Context->GetDefinition('All').'</a>, '
				." <a href=\"./\" onclick=\"CheckNone('CalendarRoleBlock'); return false;\">".$this->Context->GetDefinition('None').'</a>
				</p>
			</li>'.$this->CalendarRoles->Get().'
			
		</ul>
	
		<div class="Submit">
			<input type="submit" name="btnSave" value="'.$this->Context->GetDefinition('Save').'" class="Button SubmitButton EditCalendarButton" />
			<a href="'.GetUrl($this->Context->Configuration, 'settings.php', '', '', '', '', 'PostBackAction=Calendars').'" class="CancelButton">'.$this->Context->GetDefinition('Cancel').'</a>
		</div>
		</form>
	</fieldset>
</div>';
?>